package ph.com.gs3.formalistics.model.rdao;

import java.util.HashMap;
import java.util.Map;

import ph.com.gs3.formalistics.global.utilities.logging.FLLogger;
import ph.com.gs3.formalistics.model.HttpCommunicator;
import ph.com.gs3.formalistics.model.RemoteDataAccessObject;

public class PrintRDAO extends RemoteDataAccessObject {

	public static final String TAG = PrintRDAO.class.getSimpleName();
	public static final String RECEIVING_CORRECTION_REPORT_ID = "99";

	public PrintRDAO(String server) {
		super(new HttpCommunicator(), server);
	}

	public String getPrintableHTMLView(String documentId) throws RDAOCommunicationException {
		commonValidation();

		String url = server + "/print/hardware_test_form";

		Map<String, String> requestParams = new HashMap<String, String>();
		requestParams.put("request_id", documentId);

		return communicator.getResponseString(url, requestParams, "POST");

	}

	public String getPrintableReceivingCorrectionReportHTMLView() throws RDAOCommunicationException {
		commonValidation();

		String url = server + "/ajax/generateReport?id=" + RECEIVING_CORRECTION_REPORT_ID
		        + "&form_id=324&type=1&Validator[]=0&hide_pin_button=true";

		FLLogger.d(TAG, url);

		return communicator.getResponseString(url, null, "GET");
	}

}
